package com.woniuxy.service.impl;



import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.woniuxy.mapper.LogMapper;
import com.woniuxy.service.LogsService;
import com.work.framework.pojo.Logs;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 〈〉
 *
 * @author mjh
 * @create 2019/9/20
 */
@Service
public class LogsServiceImpl implements LogsService {

    @Autowired
    LogMapper logMapper;

    @Override
    public List<Logs> findAll(int page) {
        PageHelper.startPage(page,5);
        List<Logs> logs = logMapper.findAll();
        //System.out.println(logs);
        return logs;
    }

    @Override
    public PageInfo<Logs> All(int page){
        PageHelper.startPage(page,4);
        List<Logs> logs = logMapper.findAll();
        PageInfo<Logs> logsPageInfo = new PageInfo<Logs>(logs);
        System.out.println("logs:" + logs);
        return logsPageInfo;
    }

    @Override
    public PageInfo<Logs> findByLike(Logs logs,int page) {
        PageHelper.startPage(page,10);
        List<Logs> logsList = logMapper.findByLike(logs);
        PageInfo<Logs> logsPageInfo = new PageInfo<Logs>(logsList);
        System.out.println("logs:" + logs);
        return logsPageInfo;
    }
}
